package cn.bluedot.controller;

import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;


import cn.bluedot.bean.DataBaseBody;
import cn.bluedot.bean.PageBean;
import cn.bluedot.model.FeedSet;
import cn.bluedot.model.PigFormula;
import cn.bluedot.service.FeedService;

@Controller
@RequestMapping("/pigfeed")
public class PigFeedController {
    @Resource
    private FeedService feedService;
    
    @RequestMapping("/FeedManage")
    @ResponseBody
    public DataBaseBody getFormulas(@RequestParam("page") String page){  
        //获取按照pb页面设置查询的对应的数据
        PageBean<PigFormula> pb = feedService.getPigFormula(page);
        //response返回的json数据对象
        DataBaseBody dbb = DataBaseBody.getSuccessDataBody(pb);
        
        return dbb;
    }
    
    @RequestMapping("/SetFeedManage")
    @ResponseBody
    public DataBaseBody getSetFeeds(@RequestParam("page") String page){  
        //获取按照pb页面设置查询的对应的数据
        PageBean<FeedSet> pb = feedService.getSetFeeds(page);
        //response返回的json数据对象
        DataBaseBody dbb = DataBaseBody.getSuccessDataBody(pb);
        
        return dbb;
    }
}
